package com.yunhai.common.utils;

import java.util.Random;

/**
 * 生成 6 位长度的数字验证码
 * **/
public class ValidationCodeUtils {

    private static Random random = new Random();
    public static  String genValidateCode( int length ){

        if( length <= 0 ){
            length = 6;
        }
        StringBuilder stringBuilder = new StringBuilder();
        for( int i=0; i<length; i++ ){
            stringBuilder.append( Math.abs(random.nextInt(10)) );
        }
        return stringBuilder.toString();
    }

}
